package com.kznnc.data_structure.structure.queueStructure;

import com.kznnc.data_structure.entity.User;

import java.util.Iterator;
import java.util.PriorityQueue;

/**
 * @Description
 * @Author houchenkai
 * @Created Date: 2021/6/23 14:57
 * @ClassName
 */
public class Test {


    public static void main(String[] args) {
        PriorityQueue<User> priorityQueue = new PriorityQueue<>();
        priorityQueue.offer(new User("111",1));
        priorityQueue.offer(new User("222",2));
        priorityQueue.offer(new User("333",3));
        priorityQueue.offer(new User("444",4));
        priorityQueue.offer(new User("555",5));

        Iterator<User> iterator = priorityQueue.iterator();
        while (iterator.hasNext()){
            User next = iterator.next();
            System.out.println(next);
        }
        System.out.println(priorityQueue.poll());
        System.out.println();
        Iterator<User> iterator1 = priorityQueue.iterator();
        while (iterator1.hasNext()){
            User next = iterator1.next();
            System.out.println(next);
        }
    }
}
